<%-- 
    Document   : user_management
    Created on : May 27, 2014, 5:20:22 PM
    Author     : ThanhTuan
--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div id="wrapper_list_post">
    <div id="user_content">
        <div id="user_control">
            <%@include file="SearchUser.jsp" %>
        </div>
        <div id="user_page"> <!-- paging-->
            <c:forEach begin="1" end="${total_page}" var="i" >
                <c:if test="${current_page == i}">
                    <label>${i}</label>
                </c:if>
                <c:if test="${current_page != i}">
                    <a href="#">${i}</a>
                </c:if>
            </c:forEach>
        </div>
        <div class="mes_result">
            <c:if test="${msgResult != null}">
                ${msgResult}
            </c:if>
        </div>
        <div id="user_list">
            <table>
                <tr id="user_title">
                    <td id="col_check"><input type="checkbox"/></td>
                    <td id="col_username">User name</td>
                    <td id="col_full_name">Full name</td>
                    <td id="col_birthday">Birthday</td>
                    <td id="col_email">Email</td>
                    <td id="col_role">Role</td>
                    <td id="col_user_active">Active</td>
                    <td id="col_user_delete">Delete</td>
                   
                </tr>

                <c:forEach items="${userList}" var="list">
                    <tr>
                        <td id="col_check"><input type="checkbox"/></td>
                        <td class="col_username"><a href="/JudiBlog/usermanage?action=requestEdit&id=${list.getUserID()}">${list.getUserName()}</a></td>
                        <td class="col_full_name">${list.getFullName()}</td>
                        <td class="col_birthday">${list.getBirthday()}</td>
                        <td class="col_email">${list.getEmail()}</td>
                        <td class="col_role">${list.getRole().getRoleName()}</td>
                        <td class="col_user_active">
                            <c:if test="${list.isIsActive()}">
                                <a href="/JudiBlog/usermanage?action=requestRemove&id=${list.getUserID()}"><img src="/JudiBlog/img/enable.png" alt="i"/></a>
                            </c:if>
                            <c:if test="${!list.isIsActive()}">
                                <a href="/JudiBlog/usermanage?action=requestRestore&id=${list.getUserID()}"><img src="/JudiBlog/img/disable.png" alt="i"/></a>
                            </c:if>
                        </td>
                        <td class="col_user_delete">
                            <a href="/JudiBlog/usermanage?action=requestDelete&id=${list.userID}" onclick="return confirmDelete()"><img src="/JudiBlog/img/delete.png" alt="delete"/></a>
                         
                        </td>
                      
                    </tr>
                    <td class="line" colspan="8"></td>
                </c:forEach>
            </table>
        </div>
    </div>
</div>
<script type="text/javascript" language="javaScript">
    function del(id) {
        if (confirm("Are you sure you want to delete this user?")) {
            window.location.href = "/JudiBlog/usermanage?action=requestDelete&id=" + id;
        }
        document.form1.action("/JudiBlog/usermanage?action=requestDelete&id=" + id);
    }
</script>